package com.njitweb.controller;

import com.njitweb.mapper.CarouselMapper;
import com.njitweb.pojo.Carousel;
import com.njitweb.service.CarouselService;
import com.njitweb.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/carousel")
public class CarouselController {

    @Autowired
    private CarouselService carouselService;

    @PostMapping("/add_Carousel")
    public Result addCarousel(@RequestBody Carousel carousel) {
        carouselService.addCarousel(carousel);
        return Result.success("上传成功");
    }

    @GetMapping("/get_Carousel")
    public Result getCarousel() {
        List<Carousel> list = carouselService.listCarousel();
        return Result.success(list);
    }

}
